<form class="form-horizontal form-modal" method="post" enctype="multipart/form-data" id="editForm">

    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">编辑管理员</h4>
            </div>


            <div class="modal-body" style="padding-bottom: 30px !important;">

                <div class="wizard  clearfix" id="step">
                    <h1>账户信息</h1>
                    <fieldset>
                        <div class="form-group row">
                            <label class="col-sm-2 control-label">账号 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="name" value="{$info->name}" readonly>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 control-label">账户密码 ：</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="password" placeholder="不修改登录密码请不要填写">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                    </fieldset>

                    <h1>个人资料</h1>
                    <fieldset>
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">头像 ：</label>
                            <div class="col-sm-10">
                                <img src="{empty name='$info->headimg'}{__ADMIN__}/dist/img/default-img.png
                                {else/} {$info->headimg} {/empty}" alt="" class="upload-file-alone">
                                <div class="custom-file">
                                    <input type="file" name="headimg" class="custom-file-input" onchange="custom_file_input($(this))">
                                    <span class="custom-file-label">
                                        {if !empty($info->headimg)}
                                            {$info->headimg}
                                        {else/}
                                            选择文件
                                        {/if}
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">真实姓名 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="realname" value="{$info->realname}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">手机号码 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="mobile" value="{$info->mobile}">
                            </div>
                        </div>
                    </fieldset>

                    <h1>权限状态</h1>
                    <fieldset>
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">角色组 ：</label>
                            <div class="col-sm-10">
                                <select data-placeholder="   可多选" class="chosen-select" name="group_ids[]" multiple>
                                    {foreach $list as $item}
                                        <option value="{$item->id}" {if in_array($item->id,$info->group_ids)} selected {/if}>
                                            {$item->name}
                                        </option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">指定项目 ：</label>
                            <div class="col-sm-10">
                                <select data-placeholder="   可多选" class="chosen-select" name="project_ids[]" multiple>
                                    {foreach $project as $item}
                                    <option value="{$item->id}" {if in_array($item->id,$info->project_ids)} selected {/if}>
                                        {$item->name}
                                    </option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">状态 ：</label>
                            <div class="col-sm-10">
                                <label class="lab-radio">
                                    <input type="radio" value="1" name="status" {if $info->status == '1'} checked {/if}>显示
                                </label>
                                <label class="lab-radio">
                                    <input type="radio" value="0" name="status" {if $info->status == '0'} checked {/if}>冻结
                                </label>
                            </div>
                        </div>
                    </fieldset>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="post_form($(this),'{$Think.config.admin.app_host}/admin/account/{$info->id}')">
                    保存
                </button>
            </div>
        </div>
    </div>
</form>

<script>

    $(function () {
        $("#step").steps({
            bodyTag: "fieldset",
            enableFinishButton: false,
            enableCancelButton: false,
            labels: {
                cancel: "取消",
                current: "当前步骤：",
                pagination: "分页",
                finish: "完成",
                next: "下一步",
                previous: "上一步",
                loading: "加载中 ..."
            },
            onStepChanging: function (event, currentIndex, newIndex) {
                return $(this);
            },
        });

        $('.chosen-select').chosen({width: "100%", search_contains: true, no_results_text: "没有找到选项"});
    })
</script>